<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原型链继承</title>
</head>
<body>
    <script>
        function SuperType() {
            this.property = true;
        }

        SuperType.prototype.getSuperValue = function() {
            return this.property;
        }

        function SubType() {
            this.subproperty = false;
        }
        // 关键  创建 SuperType 的实例，并将该实例赋值给 SubType.prototype
        SubType.prototype = new SuperType();

        SubType.prototype.getSubValue = function() {
            return this.subproperty;
        }

        var instance = new SubType();
        console.log(instance.getSuperValue());
    </script>
</body>
</html>